/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityBeans;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Keith Augustsson
 */
@Entity
@Table(name = "uses")
@NamedQueries({@NamedQuery(name = "Uses.findAll", query = "SELECT u FROM Uses u"), @NamedQuery(name = "Uses.findByAirline", query = "SELECT u FROM Uses u WHERE u.usesPK.airline = :airline"), @NamedQuery(name = "Uses.findByAircraft", query = "SELECT u FROM Uses u WHERE u.usesPK.aircraft = :aircraft")})
public class Uses implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected UsesPK usesPK;

    public Uses() {
    }

    public Uses(UsesPK usesPK) {
        this.usesPK = usesPK;
    }

    public Uses(String airline, String aircraft) {
        this.usesPK = new UsesPK(airline, aircraft);
    }

    public UsesPK getUsesPK() {
        return usesPK;
    }

    public void setUsesPK(UsesPK usesPK) {
        this.usesPK = usesPK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (usesPK != null ? usesPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Uses)) {
            return false;
        }
        Uses other = (Uses) object;
        if ((this.usesPK == null && other.usesPK != null) || (this.usesPK != null && !this.usesPK.equals(other.usesPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityBeans.Uses[usesPK=" + usesPK + "]";
    }

}
